
# def calculate(x,y):
#     res = x ** y
#     return res
#     print("大") # return后不执行
#
# n = calculate(3,5)
# print(n)

# def register(name,age,major="CS",country="CN",*args,**kwargs): # major country 默认参数 必须放在最后 *args,**kwargs非固定参数，可以额外传进来
#
#     '''
#     学籍注册程序
#     :param name:str
#     :param age:integer
#     :param major: str,Chinese,CS
#     :param country: JP,CN,US
#     :return:
#     '''
#     info = """
#     ------- 你的注册信息 -------
#     name    : %s
#     age     : %s
#     major   : %s
#     country : %s
#     """%(name,age,major,country)
#     print(info)
#     print(args,kwargs)
#     print(args, kwargs.get("addr"))
#
# register(age=22,name="张三",sex="M",phone=13651054608) # 指定参数 age = 22 name = "张三"
# register("Alex",23,"Math","US","test",sex='F',addr="昌平沙河")

# name = 'Alex' # 全局变量
#
# def change():
#     # name = "金角大王" # 局部变量
#     global name # 在函数内部声明（创建）一个全局变量 不建议用
#     name = "hahaha"
#     age = 22
#     print(name)
#     print(locals()) # locals所有的局部变量
#     print(globals())
#
# change()
#
# print(name)

# names = ["Alex","Jack"]
#
# def change():
#     names.append("Racheal")
#
# change()
# print(names)

# name = "小猿圈"
#
# def change():
#     # name = "小猿圈，自学编程"
#
#     def change2():
#         # name = "小猿圈，自学编程不要钱"
#         print("第三层打印",name)
#
#     change2()
#     print("第二层打印",name)
#
# change()
#
# print("最外层打印",name)

# def calc(x,y):
#     return x ** y
#
# print(calc(2,5))
#
# c = lambda x,y:x ** y
# print(c(2,8))
#
# def calc1(x):
#     return x ** 2
#
# res = map(lambda x:x ** 2,[1,5,7,4,8]) # 将列表[1,5,7,4,8]中的数，依次交给前面的函数，构成循环
# print(res)
# for i in res:
#     print(i)
#
# res = map(lambda x:x ** 2 if x > 5 else x ** 3,[1,5,7,4,8])
# print(res)
# for i in res:
#     print(i)
#
# res = map(calc1,[1,5,7,4,8])
# print(res)
# for i in res:
#     print(i)

def get_abs(n):
    return int(str(n).strip("-")) # strip 跳过特定字符

print(get_abs(-9))

def add(x,y,f):
    return f(x + y)

print(add(5,-10,get_abs))